import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
  ],
  server: {
    proxy: {
      '/api': {
        target: 'http://www.abc.com',
        //https://devapi.qweather.com/v7/weather/3d?location=101010100&key=这里替换成你的key
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '/api')
      },
      '/v7':{
        target: 'https://devapi.qweather.com',
        changeOrigin: true,
      },
      '/v2':{
        target: 'https://geoapi.qweather.com',
        changeOrigin: true,
      }
    }
  }
})
